ST

[TFS 0.x] New look system

Por Sttorm, 16 de mai. de 2018 em CreatureScripts e Movements

3
3.8k
SttormS
16 de maio de 2018 às 16:00

Fala pessoal , vi muita galera com problema no look (principalmente em narutibias). Então resolvi refazer o sistema de look


tcx9XuR.jpg

 

 

Crie um novo arquivo em Creaturescripts e cole isso ( Tem que registrar na XML e no login.lua, ambas tags estão na script)

-- <event type="look" name="showVoc" event="script" value="showvoc.lua"/>
-- registerCreatureEvent(cid, showVoc)

local t = {

[-1] = "Estudante",
[0]  = "Estudante",
[1]  = "Genin",
[2]  = "Chunnin",
[3]  = "Jounin",
[4]  = "Anbu",
[5]  = "Sennin"

}

function onLook(cid, thing, position, lookDistance)


local storage = 35461
local get_description = t[getPlayerStorageValue(thing.uid, storage)]
local get_sex = (getPlayerSex(thing.uid) == 0 and "She" or "He")
local get_town = getTownName(getPlayerTown(thing.uid))
    
    if isPlayer(thing.uid) and thing.uid ~= cid then  
    doPlayerSetSpecialDescription(thing.uid, "\n ".. get_sex .." are ".. get_description ..". \n ".. get_sex .." is the resident of ".. get_town ..".")
    end 
    return true     
end

Como o sistema funciona ? como eu configuro ? 

Primeiramente , a script pega o valor que o player tem de uma storage e a identifica na tabela , onde o que está entre "[]" é o valor da storage
Exemplo : O player tem a storage 35461 e 3 como o value dela , então no look retornará Jounin 
Para configurar , mecha aqui

local t = {

[-1] = "Estudante",
[0]  = "Estudante",
[1]  = "Genin",
[2]  = "Chunnin",
[3]  = "Jounin",
[4]  = "Anbu",
[5]  = "Sennin"

}

Lembrando que a ultima parte não deverá conter virgula , ficando assim

local t = {

[-1] = "Estudante",
[0]  = "Estudante",
[1]  = "Genin"
  
}

A script não funciona se você der look em si mesmo.
Chars com group maior que 2 retornarão erro ao dar look.

1 ano depois...
shadowzimS
04 de junho de 2019 às 23:11
local t = {

[-1] = "Estudante",
[0]  = "Estudante",
[1]  = "Genin",
[2]  = "Chunnin",
[3]  = "Jounin",
[4]  = "Anbu",
[5]  = "Sennin"

}

function onLook(cid, thing, position, lookDistance)


local storage = 35461
local get_description = t[getPlayerStorageValue(thing.uid, storage)]
if thing.uid == cid then
  get_sex = "You"
else 
  get_sex = (getPlayerSex(thing.uid) == 0 and "She" or "He")
End
  
local get_town = getTownName(getPlayerTown(thing.uid))
    
    if isPlayer(thing.uid) and thing.uid ~= cid then  
    doPlayerSetSpecialDescription(thing.uid, "\n ".. get_sex .." are ".. get_description ..". \n ".. get_sex .." is the resident of ".. get_town ..".")
    end 
    return true     
end

Com Isso, resolve o problema de dar look em si mesmo, já a parte dos groups, eu precisaria saber como funciona e como eles estão distribuidos no seu servidor pra que eu possa mudar...

2 semanas depois...
leozinpbbL
12 de junho de 2019 às 11:34

@Sttorm PODERIA ME AJUDAR, NO MEU EU INSTALEI TUDO CERTO , POREM QUANDO VAI DAR LOOK NAO APARECE NADA .

 USO TFS. 0.4  ( 8.6)

 

Screenshot_39.png